package test_2024_4_9_01_java;

import java.util.Scanner;

public class Supermarket{


	public void show() {
		
		System.out.println("--------------首页--------------");
		System.out.println("请选择：");
		System.out.println("1. 挑选商品");
		System.out.println("2. 结账页面");
		System.out.println("3. 幸运大奖");	
		System.out.println("(按任意键取消购物)");
		System.out.println("请选择：");
	}
	
	public double shopping(double payMoney) 
	{
		System.out.println("--------------欢迎来到选购商品页面--------------");
		Scanner scan = new Scanner(System.in);
		boolean flag = true;
		
		while(flag)
		{
			System.out.println("1. 苹果 ￥2");
			System.out.println("2. 梨  ￥5");
			System.out.println("3. 香蕉 ￥3");
			System.out.println("--------------请选择您需要的商品--------------");
			int i = scan.nextInt();
			
			switch(i)
			{
			case 1:
				payMoney += 2;
				System.out.println("总消费：" + payMoney + "(消费满66.6可获得抽奖一次)");
				break;
			case 2:
				payMoney += 5;
				System.out.println("总消费：" + payMoney + "(消费满66.6可获得抽奖一次)");
				break;
			case 3:
				payMoney += 3;
				System.out.println("总消费：" + payMoney + "(消费满66.6可获得抽奖一次)");
				break;
			default:
				System.out.println("离开？！(y / other)");
				String y = scan.next();
				switch(y)
				{
				case "y":
				flag = false;
				break;
				};
			}
			
		}
		return payMoney;
		}
		
	public void pay(double payMoney)
	{
		System.out.println("待支付：" + payMoney);
	}
	
	public void luckliy(double payMoney) {
		if(payMoney >= 66.6) {
			System.out.println("叮叮叮~" + "\r\n" + "恭喜你触发天赋选择！" + "\r\n" + "随机抽取您的天赋：");
			
			System.out.println("很遗憾，未中奖~");
		}
		else {
			System.out.println("消费金额不足，无法进行抽奖！");
		}
	}

	
}
